import {Link, Outlet} from 'umi';
import styles from './index.less';
import React from "react";
import {history} from "umi";
import {useModel} from "umi";

export default function Layout() {
    const masterProps = useModel('@@qiankunStateForSlave');
    console.log(masterProps, "masterProps213123")
    return (
        <div className={styles.navs}>
            <div style={{textAlign: "center"}}>使用@umijs/plugins/dist/qiankun实现微前端</div>
            <header>
                <button onClick={() => {
                    history.push("/child1")
                }}>点击展示child1
                </button>
                <button onClick={() => {
                    masterProps.setGlobalState({slogan: "改变了"})
                }}>给child1传一个值
                </button>
                <button onClick={() => {
                    history.push("/child2")
                }}>点击展示child2
                </button>
            </header>
            <main>
                <div>内容区</div>
                <div id={"container"}>
                    <Outlet/>
                </div>
            </main>
        </div>
    );
}
